﻿$(function () {

    $('.ui-del').click(function (e) {
        e.preventDefault();
        e.stopPropagation();

        var $recId = parseInt($(this).attr('recordId'));

        $('#dialog-record-delete:ui-dialog').dialog('destroy');

        $('#dialog-record-delete').dialog({
            resizable: false,
            height: 200,
            modal: true,
            buttons: {
                'Usuń rekord': function () {
                    $(this).dialog('option', 'buttons', [{
                        text: "Usuwanie rekordu",
                        click: function () { $(this).dialog("close"); }
                    }]);

                    $('<input type="hidden" name="action" value="RemoveRecord" />').appendTo($('form:eq(0)'));
                    $('<input type="hidden" name="recordId" value="' + $recId + '" />').appendTo($('form:eq(0)'));
                    $('form:eq(0)').submit();

                },
                'Anuluj': function () {
                    $(this).dialog('close');
                }
            }
        });
    });

    $('.nemo-records .field-id, .nemo-records .field-identyficator, .nemo-records .field-time').click(function () {
        ShowPopup($(this).parent().find('.ui-prev').attr('href'));
    });

});